<%@ page import="java.sql.*" %>
<%@ page import="com.nxcy.mysql.DBUtils" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改学生</title>
</head>
<body>

<%
    Object oname=session.getAttribute("name");
    if(oname==null){
        request.setAttribute("msg","请登录后查看");
        request.getRequestDispatcher("login.jsp").forward(request,response);
    }
    String id=request.getParameter("id");
    DBUtils db=new DBUtils();
    String sql="SELECT * from t_user t where t.id="+id+" limit 0,1";
    ResultSet rs= db.executeQuery(sql);
    String sno = "";
    String name = "";
    String sex = "";
    String clazz = "";
    String homepath = "";
    String phone = "";
    String username = "";
    String password = "";
    if (rs.next()) {
        sno = rs.getString("sno");
        name = rs.getString("name");
        sex = rs.getString("sex");
        clazz = rs.getString("clazz");
        homepath = rs.getString("home_path");
        phone = rs.getString("phone");
        username = rs.getString("username");
        password = rs.getString("password");
    }
    db.close();
%>

<center>
    <form action="doUpdate.jsp" method="post">
        <span style="color: red;font-weight: bold">${msg}</span>
        <table border="1px">
            <tr>
                <td>学号</td>
                <input type="hidden" name="id" value="<%=id%>">
                <td><input type="text" name="sno" value="<%=sno%>" readonly></td>
            </tr>
            <tr>
                <td>姓名</td>
                <td><input type="text" name="name" id="name" value="<%=name%>"></td>
            </tr>
            <tr>
                <td>性别</td>
                <td>
                    <select name="sex" id="sex">
                    <option value="男" <%="男".equals(sex)?"selected":""%>>男</option>
                    <option value="女" <%="女".equals(sex)?"selected":""%>>女</option>
                </select>
                </td>
            </tr>
            <tr>
                <td>电话号码</td>
                <td><input type="text" name="phone" id="phone" value="<%=phone%>"></td>
            </tr>
            <tr>
                <td>用户名</td>
                <td><input type="text" name="username" id="username" value="<%=username%>"></td>
            </tr>
            <tr>
                <td>密码</td>
                <td><input type="password" name="password" id="password" value="<%=password%>"></td>
            </tr>
            <tr>
                <td>班级</td>
                <td><input type="text" name="clazz" id="clazz" value="<%=clazz%>"></td>
            </tr>
            <tr>
                <td>根目录</td>
                <td><input type="text" name="homepath" id="homepath" value="<%=homepath%>"></td>
            </tr>
            <tr>
                <td><input type="submit" value="保存"></td>
                <td><input type="reset" value="重置"></td>
            </tr>
        </table>





    </form>


</center>


</body>
</html>
